home *** CD-ROM | disk | FTP | other *** search
/ BMUG PD-ROM 1995 Fall / PD-ROM F95.toast / Programming / Programming Utilities / ViewIt 2.04 ƒ / ViewIt™ 2.04 Shareware / FaceWare / FaceWare.rsrc / TEXT_1276_U3. Files.txt < prev    next >
Encoding:
Text File  |  1992-08-16  |  4.8 KB  |  34 lines

  1. U3. Files
  2.   UtilIt provides a high level interface to the File Manager that facilitates opening of the standard file dialogs, tracking file locations, and resetting file types.
  3.  
  4. StdOpn  201  b,c,d,uString,uName,uResult,uI2
  5.   Displays standard "Open" file dialog where b, c, and d define the initial position of the dialog (see the MovRec command in "Windows" topic), uName (if not empty) is used to redefine the text displayed in the "Open" button, and uString can contain up to 21 12-character "records" to designate file filtering.
  6.   Each 12-character file filtering "record" in uString consists of an optional 4-character file type, 4-character file creator, and 1 to 4 character extension (w/o a leading ".").  Use spaces to designate entries that should be ignored, and all records except the last record must be exactly 12 characters long.  "TEXTMYPGtextPICT    pic DATA", for example, consists of three records which would cause UtilIt to display all files of type "TEXT" and creator "MYPG" with the extension ".text", and all files of type "PICT" with the extension ".pic", and all files of type "DATA".  If uString is empty, then all files are displayed (no filtering is done).
  7.   When the dialog is closed, the variable uResult returns with the button pressed (1 = Open, 2 = Cancel).  If the Open button is pressed, then uName is set equal to the name of the file, the default volume or directory is set to the disk or HFS folder which contains the file, uI2 is set equal to the working directory reference number, and uString is set equal to the type, creator, and extension of the chosen file in a single filter record like that described above.
  8.   For example, suppose you wished to have the user choose a file from a standard file dialog that showed only files of type "TEXT" and creator "MYPG", had "Run" as its default button, and was centered horizontally, 1/3 from the top of the main screen.  The following code fragment would do this: 
  9.     uString := 'TEXTMYPG';
  10.     uName := 'Run';
  11.     FaceIt(nil,StdOpn,0,0,4,1);
  12.     if (uResult = 1) then
  13.      [uName contains chosen file name]
  14. NOTE:  When filtering by creator, remember that programs under development, as well as the files they create, may not yet have been given the proper creator designation.
  15.  
  16. StdSav  202  b,c,d,uString,uName,uResult,uI2
  17.   Displays the standard "Save As" dialog where b, c, and d define the initial position of the dialog (see MovRec in "Windows" topic), uString is used as the prompt string, and uName as the default file name.
  18.   When the dialog is closed, uResult returns the button pressed (1 = Save, 2 = Cancel).  If the Save button was pressed, then uName is set equal to the file name entered by the user, the default volume or directory is set to the disk or HFS folder selected by the user, and uI2 is set equal to the working directory reference number.
  19.  
  20. GetRef  205  a,uI2,uResult
  21.   Returns in uI2 the working directory reference number designated by a where a = 0 returns the current directory and a = 1 returns the active System folder. The variable uResult will contain a value less than zero (an OSErr) if an error occurs.  uString and uName are not changed by calls to GetRef.  This command is primarily provided for those programmers who do not have access to the high-level toolbox routine GetVol.
  22.  
  23. SetRef  206  a,uResult
  24.   Resets the current directory to that designated by a where a is either a working directory reference number or a = 1 designates the active System folder.  (If a = 0, the current directory is not changed.)  uResult will return a value less than zero (an OSErr) if an error occurs.  uString and uName are not changed by calls to SetRef.  This command is primarily provided for programmers who do not have access to the high-level toolbox routine SetVol.
  25.   FORTRAN PROGRAMMERS:  Note that parameter a must be a 4-byte integer even though working directory reference numbers are 2 bytes in length.  Don't make the mistake, for example, of saving a reference number in a 2-byte integer and then attempt to pass that variable in a call to SetRef.  Save reference numbers in 4-byte integer variables and pass these back to SetRef:
  26.  integer*4 saveRef
  27.  ...
  28.  call FaceIt(0,GetRef,0,0,0,0)
  29.  saveRef = uI2  !integer*2->*4 w/ sign preserved
  30.  ...
  31.  call FaceIt(0,SetRef,saveRef,0,0,0)
  32.  
  33. SetTyp  208  a,uString,uName,uResult
  34.   Resets the file type and/or creator of the file whose name is given by uName in the directory designated by a where a is either a working directory reference number, or a = 0 designates the current directory, or a = 1 designates the active System folder.  The new file type and creator are designated by the first 8 characters of uString using the same scheme as that defined above for StdOpn.  uResult will return a value less than zero (an OSErr) if an error occurs.  This command is primarily provided for those programmers who do not have access to the high-level toolbox routine SetFInfo.